package com.jt.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jt.service.DubboItemService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * <p>
 *
 * </p>
 *
 * @author Song
 * @since 2020/11/19
 */
@Controller
@RequestMapping("/items")
public class ItemController {

    @Reference(check = false)
    private DubboItemService dubboItemService;

    @RequestMapping("/{id}")
    public String findItemById(@PathVariable Long id, Model model){

        model.addAttribute("item", dubboItemService.findItemById(id));
        model.addAttribute("itemDesc",dubboItemService.findItemDescById(id));
        return "item";
    }
}
